import csv
import numpy as np
from pandas import DataFrame
import pandas as pd

# all digits are decreased by 1


len_total = 280
len_freq = 7
len_body = 5
len_star = 2

freq_body = []
freq_star = []

relation_body = np.zeros(shape=(50,50))
relation_star = np.zeros(shape=(11,11))

def rel_body(firstCounter, list_data):
	first = firstCounter + 1
	if (first>= len_body):
		return 
	for i in range(first, len_body):
		relation_body[int(list_data[firstCounter])-1, int(list_data[i])-1] += 1
		relation_body[int(list_data[i])-1, int(list_data[firstCounter])-1] += 1

def rel_star(first,second):
	relation_star[int(first)-1,int(second)-1] +=1
	relation_star[int(second)-1,int(first)-1] +=1


def read():
	with open('data.csv','rb') as csvfile:
		data = csv.reader(csvfile, delimiter=';')
		for row in data:
			for i in range(len_body):
				rel_body(i,row)
			rel_star(row[len_body],row[len_body+1])

def read_freq():
	with open('data.csv','rb') as csvfile:
		data = csv.reader(csvfile, delimiter=';')
		counter = 0
		for row in data:
			if counter > 28:
				return 
			else :
				counter += 1
			for i in range(len_body):
				freq_body

def to_csv():
	df_body = pd.DataFrame(rel_body)
	df_star = pd.DataFrame(rel_star)
